package com.hulizuofang.wol.chat.client.ui.event.whoisonline;

import java.util.Set;

import com.google.gwt.event.shared.GwtEvent;
import com.google.gwt.event.shared.HasHandlers;
import com.hulizuofang.wol.chat.client.ui.user.ChatUser;

public class UpdateWhoisOnlineEvent extends GwtEvent<WhoisOnlineHandler> {
	private static final Type<WhoisOnlineHandler> TYPE = new Type<WhoisOnlineHandler>();
	private final Set<ChatUser> users;

	UpdateWhoisOnlineEvent(Set<ChatUser> users) {
		this.users = users;
	}
	
	public Set<ChatUser> getUsers() {
		return users;
	}

	public static void fire(final HasHandlers source, Set<ChatUser> users) {
		source.fireEvent(new UpdateWhoisOnlineEvent(users));
	}

	public static Type<WhoisOnlineHandler> getType() {
		return TYPE;
	}
	@Override
	public Type<WhoisOnlineHandler> getAssociatedType() {
		return getType();
	}

	@Override
	protected void dispatch(WhoisOnlineHandler handler) {
		handler.onUpdateWhoisOnline(this);
	}

}
